home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.2 Applications 1996 May / SGI IRIX 6.2 Applications 1996 May.iso / dist / impr_dev.idb / usr / impressario / src / examples / libspool / spoolers.c.z / spoolers.c
Encoding:
C/C++ Source or Header  |  1996-05-07  |  3.0 KB  |  109 lines

  1. /**************************************************************************
  2.  *                                      *
  3.  *           Copyright (c)    1991 Silicon Graphics, Inc.          *
  4.  *            All Rights Reserved                    *
  5.  *                                      *
  6.  *       THIS    IS UNPUBLISHED PROPRIETARY SOURCE CODE OF SGI          *
  7.  *                                      *
  8.  * The copyright notice above does not evidence any actual of intended      *
  9.  * publication of such source code, and is an unpublished work by Silicon *
  10.  * Graphics, Inc. This material contains CONFIDENTIAL INFORMATION that is *
  11.  * the property of Silicon Graphics, Inc. Any use, duplication or      *
  12.  * disclosure not specifically authorized by Silicon Graphics is strictly *
  13.  * prohibited.                                  *
  14.  *                                      *
  15.  * RESTRICTED RIGHTS LEGEND:                          *
  16.  *                                      *
  17.  * Use, duplication or disclosure by the Government is subject to      *
  18.  * restrictions as set forth in subdivision (c)(1)(ii) of the Rights in      *
  19.  * Technical Data and Computer Software clause at DFARS 52.227-7013,      *
  20.  * and/or in similar or successor clauses in the FAR, DOD or NASA FAR      *
  21.  * Supplement. Unpublished - rights reserved under the Copyright Laws of  *
  22.  * the United States. Contractor is SILICON GRAPHICS, INC., 2011 N.      *
  23.  * Shoreline Blvd., Mountain View, CA 94039-7311              *
  24.  **************************************************************************
  25.  *
  26.  * File: spoolers.c
  27.  *
  28.  * Description: Prints which spooling system is the default and the
  29.  *    available spooling systems.
  30.  *
  31.  **************************************************************************/
  32.  
  33.  
  34. #ident "$Revision: 1.1 $"
  35.  
  36.  
  37. #include <stdio.h>
  38. #include <stdlib.h>
  39. #include "spool.h"
  40.  
  41.  
  42. main()
  43. {
  44.     unsigned int def, spoolers;
  45.  
  46.     /*
  47.      * Obtain default spooler and available spooling systems
  48.      */
  49.     if (SLGetSpooler(&def, &spoolers) < 0) {
  50.     SLPerror("spooler");
  51.     exit(1);
  52.     }
  53.  
  54.     /*
  55.      * Print the name of the default spooler
  56.      */
  57.     (void)printf("Default spooler: ");
  58.     switch (def) {
  59.     case SL_SPOOLER_NONE:
  60.         (void)printf("None\n");
  61.         break;
  62.     case SL_SPOOLER_BSD:
  63.         (void)printf("BSD\n");
  64.         break;
  65.     case SL_SPOOLER_SYSV:
  66.         (void)printf("Sys V\n");
  67.         break;
  68.     }
  69.  
  70.     /*
  71.      * Print a list of available spooling systems
  72.      */
  73.     (void)printf("Available spoolers: ");
  74.     if (spoolers == SL_SPOOLER_NONE)
  75.     (void)printf("None");
  76.     if (spoolers & SL_SPOOLER_BSD)
  77.     (void)printf("BSD ");
  78.     if (spoolers & SL_SPOOLER_SYSV)
  79.     (void)printf("Sys V ");
  80.     (void)printf("\n");
  81.  
  82.     /*
  83.      * As a test try to set BSD spooler as default
  84.      */
  85.     (void)printf("\nTrying to explictly select BSD spooler...\n");
  86.     if (SLSetSpooler(SL_SPOOLER_BSD) < 0)
  87.     (void)printf("Spooler was not available and was not set\n");
  88.     else
  89.     (void)printf("Spooler available and set\n");
  90.     if (SLGetSpooler(&def, &spoolers) < 0) {
  91.     SLPerror("spooler");
  92.     exit(1);
  93.     }
  94.     (void)printf("\nNew Default spooler: ");
  95.     switch (def) {
  96.     case SL_SPOOLER_NONE:
  97.         (void)printf("None\n");
  98.         break;
  99.     case SL_SPOOLER_BSD:
  100.         (void)printf("BSD\n");
  101.         break;
  102.     case SL_SPOOLER_SYSV:
  103.         (void)printf("Sys V\n");
  104.         break;
  105.     }
  106.  
  107.     return 0;
  108. }
  109.